home *** CD-ROM | disk | FTP | other *** search
- From: Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
- Date: Mon, 4 Jul 94 11:15:42 +0200
- Message-Id: <9407040915.AA00368@issan.informatik.uni-dortmund.de>
- To: mint@atari.archive.umich.edu
- In-Reply-To: <m0q63pG-0000aKC@sdf.lonestar.org> (ekl@sdf.lonestar.org)
- Subject: Memory protection without MultiTOS
-
- In an old mail ekl@sdf.lonestar.org (Evan K. Langlois) wrote:
-
- |> Yes, for memory protection, your only choice is to run MultiTOS, or no GEM.
- |> There is no way around that!
-
- Actually, there is. Here is a patch to allow running the old AES
- under memory protection. It turns all memory requests by the AES into
- global accessible, so that the resource tree can be accessed by both
- the program and the AES. Also the first process started by the AES
- (the real GEM process) is marked to have global memory protection.
- Note that the accessories must run in global memory too, you have to
- change the file header appropriately. There are still problems with
- accessories that dynamically request memory during runtime, since it
- is allocated in the context of the running program and thus private by
- default, but this is considered bad programming style anyway (XCONTROL
- 1.31 is such a beast :-/ ).
-
- This is kind of a hack, especially the distinction between Malloc from
- AES and VDI. This only works if the AES code is located after the VDI
- code in the roms, which is the case in all TOS versions i know of
- (1.00, 1.02, 1.04, 3.06), but it may fall over with other versions.
-
-
- --- orig/dosmem.c Wed Feb 2 23:43:02 1994
- +++ dosmem.c Sat Jul 2 15:36:28 1994
- @@ -120,8 +120,19 @@
- if (((mode & F_PROTMODE) == 0) &&
- (curproc->ctxt[SYSCALL].pc > 0x00e00000L) &&
- (curproc->ctxt[SYSCALL].pc < 0x00efffffL)) {
- +#ifndef MULTITOS
- + extern long gem_start;
- + if (gem_start && curproc->ctxt[SYSCALL].pc >= gem_start)
- + {
- + mode |= F_PROT_G + 0x10;
- + TRACE (("m_xalloc: AES special (call from ROM)"));
- + }
- + else
- +#endif
- + {
- mode |= (F_PROT_S + 0x10) | F_KEEP;
- TRACE(("m_xalloc: VDI special (call from ROM)"));
- + }
- }
- /*
- * If the mode argument comes in a zero, then set it to the default
- @@ -319,6 +330,9 @@
- char localname[PNAMSIZ+1];
- XATTR xattr;
- int newpid;
- +#ifndef MULTITOS
- + extern BASEPAGE *gem_base;
- +#endif
-
- #ifdef DEBUG_INFO
- /* tfmt and tail_offs are used for debugging only */
- @@ -387,6 +401,13 @@
- DEBUG (("Pexec: invalid protection mode changed to private"));
- flags = (flags & ~F_PROTMODE) | F_PROT_P;
- }
- +#ifndef MULTITOS
- + if ((flags & F_PROTMODE) == 0 && curproc->base == gem_base)
- + {
- + flags |= F_PROT_G;
- + TRACE (("p_exec: AES special"));
- + }
- +#endif
- /* and fall through */
- case 5:
- mkbase = 1;
- --- orig/main.c Fri Feb 11 20:37:16 1994
- +++ main.c Fri Jul 1 18:43:06 1994
- @@ -125,6 +125,8 @@
- static int init_is_gem = 1; /* set to 1 if init_prg is GEM */
- #else
- static int init_is_gem = 0; /* set to 1 if init_prg is GEM */
- +BASEPAGE *gem_base = 0;
- +long gem_start = 0;
- #endif
- static const char *init_prg = 0;
-
- @@ -893,6 +895,11 @@
- (char *)((long)F_FASTLOAD | F_ALTLOAD | F_ALTALLOC | F_PROT_S),
- (char *)"\0", init_env);
- bp->p_tbase = *((long *) EXEC_OS );
- +#ifndef MULTITOS
- + if (((long *) sysbase[5])[0] == 0x87654321)
- + gem_start = ((long *) sysbase[5])[2];
- + gem_base = bp;
- +#endif
- r = p_exec(106, (char *)"GEM", bp, 0L);
- pid = (int)r;
- if (pid > 0) {
-
- --
- +------------------------------------------------------------------------+
- Andreas Schwab "And now for something
- schwab@ls5.informatik.uni-dortmund.de completely different"
-